import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询
export function listAppUser(query) {
  return request({
    url: '/app/user/list',
    method: 'get',
    params: query
  })
}

//查询详情
export function getAppUser(userId) {
  return request({
    url: '/app/user/' + parseStrEmpty(userId),
    method: 'get'
  })
}

// 更新
export function updateAppUser(data) {
  return request({
    url: '/app/user',
    method: 'put',
    data: data
  })
}

export function addAppUser(data) {
  return request({
    url: '/app/user',
    method: 'post',
    data: data
  })
}


// 删除用户
export function delAppUser(userId) {
  return request({
    url: '/app/user/' + userId,
    method: 'delete'
  })
}

export function changeUserStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/app/user/changeStatus',
    method: 'put',
    data: data
  })
}

export function resetUserPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/app/user/resetPwd',
    method: 'put',
    data: data
  })
}
